if (!navigator.cookieEnabled) {
    $("#cookiesVerify").html("开启cookies之后才能正常登陆&nbsp;&nbsp;<a href='./help.html'>如何开启？</a>");
}
function initPage() {
    $("#subBtn").removeAttr("disabled");
    $("#verifycode").attr("src", c.BASE_URL_DEV + "va.veritycode");
    $("#verifycode").live("click", refreshCode);
    $("#refreshVerifyVode").live("click", refreshCode);
    $("#subBtn").live("click", submitForm);
    //登录系统
    function submitForm() {
        console.log("getKey()==" + getKey());
        var _that = this;
        $(_that).attr("disabled", "disabled");
        var _data = $(this).parent("form").serialize() + "&token=" + getKey();
        $.postjsonp(c.BASE_URL_DEV + "loginController/login", _data, true,
            function (data) {
                console.log(data);
                var _r = data.result;
                if (_r.code == 200) {
                    $("#senVerify").text("");
                    setKey(_r.obj.token);
                    sessionSet("uid", _r.obj.id);
                    sessionSet(_r.obj.token, $("#inputUserName").val()); //根据本次回话的ID存储当前用户名
                    $("#msg").addClass("normal").text("登陆成功，正在跳转...");
                    setTimeout(function () {
                        location.href = "index.html";
                    }, 2500);
                } else if (_r.code == 502) {
                    $("#senVerify").text(_r.msg);
                    $(_that).removeAttr("disabled");
                } else if (_r.code == -1) {
                    $("#senVerify").text(_r.msg + ",请刷新验证码！");
                    sessionStorage.clear();
                    getToken();
                    $(_that).removeAttr("disabled");
                } else {
                    $("#msg").addClass("error").text(_r.msg);
                    $(".spinner").addClass("hide");
                    $(_that).removeAttr("disabled");
                }
            }, ajaxError
        );
    }

/**
 * 刷新验证码
 */
function refreshCode() {
    $("#verifycode").attr("src", c.BASE_URL_DEV + "va.veritycode?v=" + new Date().getTime());
    $("#senVerify").text("");
}
}
$(initPage);